package com.sean.applet;

import java.awt.Color;
import java.awt.Container;
import java.awt.GridBagLayout;
import java.awt.GridLayout;

import javax.swing.JApplet;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

public class SampleApplet extends JApplet {
    @Override
    public void init() {
	JPanel p = new JPanel();
	p.setLayout(new GridLayout(2, 2, 2, 2));
	p.add(new JLabel("Username:"));
	p.add(new JTextField());
	p.add(new JLabel("Password:"));
	p.add(new JPasswordField());
	Container content = getContentPane();
	content.setLayout(new GridBagLayout()); // Used to center the panel
	content.add(p);

	setBackground(Color.BLUE);
    }
}

/*
 * Java Swing, Second Edition Tips and Tools for Killer GUIs By Marc Loy, Robert
 * Eckstein, Dave Wood, James Elliott, Brian Cole Second Edition November 2002
 * http://www.oreilly.com/catalog/jswing2/
 */